package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.system.mapper.AdminCompanyMapper;
import com.ruoyi.system.domain.AdminCompany;
import com.ruoyi.system.service.IAdminCompanyService;
import com.ruoyi.common.core.text.Convert;

/**
 * 机构Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-06-09
 */
@Service
public class AdminCompanyServiceImpl implements IAdminCompanyService 
{
    @Autowired
    private AdminCompanyMapper adminCompanyMapper;

    /**
     * 查询机构
     * 
     * @param companyId 机构ID
     * @return 机构
     */
    @Override
    public AdminCompany selectAdminCompanyById(Long companyId)
    {
        return adminCompanyMapper.selectAdminCompanyById(companyId);
    }

    /**
     * 查询机构列表
     * 
     * @param adminCompany 机构
     * @return 机构
     */
    @Override
    public List<AdminCompany> selectAdminCompanyList(AdminCompany adminCompany)
    {
        return adminCompanyMapper.selectAdminCompanyList(adminCompany);
    }

    /**
     * 新增机构
     * 
     * @param adminCompany 机构
     * @return 结果
     */
    @Override
    public int insertAdminCompany(AdminCompany adminCompany)
    {
        adminCompany.setCreateTime(DateUtils.getNowDate());
        return adminCompanyMapper.insertAdminCompany(adminCompany);
    }

    /**
     * 修改机构
     * 
     * @param adminCompany 机构
     * @return 结果
     */
    @Override
    public int updateAdminCompany(AdminCompany adminCompany)
    {
        adminCompany.setUpdateTime(DateUtils.getNowDate());
        return adminCompanyMapper.updateAdminCompany(adminCompany);
    }

    /**
     * 删除机构对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAdminCompanyByIds(String ids)
    {
        return adminCompanyMapper.deleteAdminCompanyByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除机构信息
     * 
     * @param companyId 机构ID
     * @return 结果
     */
    @Override
    public int deleteAdminCompanyById(Long companyId)
    {
        return adminCompanyMapper.deleteAdminCompanyById(companyId);
    }
    
    /**
     * 机构状态修改
     * 
     * @param company 机构信息
     * @return 结果
     */
    @Override
    public int changeStatus(AdminCompany adminCompany)
    {
        return adminCompanyMapper.updateAdminCompany(adminCompany);
    }
}
